<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>

<body class="gray-bg">
	
	<link rel="stylesheet" th:href="@{/asserts/js/plugins/ztree/css/metroStyle/metroStyle.css}" type="text/css">
	
	<div class="container-div">
		<div class="row">
		
			<!-- 
			 <div class="card col-lg-3">
                  <div class="box box-main  search-collapse">
						<div class="box-header">
							<div class="box-title">
								<i class="fa icon-grid"></i> 组织机构
							</div>
							<div class="box-tools pull-right">
								<button type="button" class="btn btn-box-tool" id="btnAdd" title="添加部门" onclick="openDept()"><i class="fa fa-plus"></i></button>
								<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
							</div>
						</div>
						<div class="ui-layout-content">
							<ul id="treeDemo" class="ztree"></ul>	
						</div>
					</div>
					
             </div>
			 -->
			 
			 <div class="col-lg-12">
			 
				<div class="col-sm-12 search-collapse" style="display:none">
					<form id="operlog-form">
						<label>排序字段 </label><input type="text" name="condition[resourceOrder|orderBy]" value="true" />
					</form>
				</div>
				
				<div class="btn-group-sm" id="toolbar" role="group">
					<a class="btn btn-success" onclick="$.operate.add()">
						<i class="fa fa-plus"></i> 新增
					</a>
					<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()">
			            <i class="far fa-trash-alt"></i> 删除
			        </a>
			        
			        <!-- 
			        <a class="btn btn-danger" onclick="$.operate.clean()">
		                <i class="fa fa-trash"></i> 清空
		            </a>
			        -->
			        
		            <a class="btn btn-warning" onclick="$.table.exportExcel()">
			            <i class="fa fa-download"></i> 导出
			        </a>
		        </div>
		        
				<div class="col-sm-12 select-table table-striped">
					<table id="bootstrap-table" data-mobile-responsive="true"></table>
				</div>
				
			</div>
			
			
		</div>
	</div>
	
	<footer th:replace="dashboard/footer :: footer"></footer>
	
	<script type="text/javascript" th:src="@{/asserts/js/plugins/ztree/js/jquery.ztree.core.js}"></script>
	<script type="text/javascript" th:src="@{/asserts/js/plugins/ztree/js/jquery.ztree.excheck.js}"></script>
	<script type="text/javascript" th:src="@{/asserts/js/plugins/ztree/js/jquery.ztree.exedit.js}"></script>

	<script type="text/javascript">
		
		var prefix = ctx + "basic/menus/";

		$(function() {
		    var options = {
		        url: prefix+"datatables" ,
		        createUrl: prefix + 'add' ,
		        updateUrl: prefix+"modify?id={id}" ,
		        statusUrl: prefix+"changeStatus?id={id}" , 
		        cleanUrl: prefix + "clean",
		        detailUrl: prefix+"detail?id={id}",
		        removeUrl: prefix+"delete" ,
		        exportUrl: prefix + "exportExcel",
		        sortName: "operTime",
		        uniqueId:"id" ,
		        sortOrder: "desc",
		        modalName: "菜单",
		        escape: true,
		        showPageGo: true,
		        rememberSelected: true,
		        columns: [{field: 'state',checkbox: true },
		        	 
					{field: 'resourceIcon', title: '图标' , width:'30' , align: 'center' , formatter:function(value,row,index){
			                return '<i class="'+value+'"></i>' ; 
						}
		        	},
			        {field: 'resourceName', title: '菜单名称'},
			        {field: 'resourceLink', title: '菜单链接'},
			        {field: 'resourceOrder', title: '排序' , align: 'center'},
			        {field: 'hasStatusLabel', title: '状态', align: 'center',  formatter:function(value,row,index){ return $.table.status(value , row);}},
			        {field: 'id' , title: '操作',  align: 'center', width:'170', formatter: function(value, row, index) {
			                var actions = [];
			                
			                actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
			                actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="far fa-trash-alt"></i>删除</a> ');
			                
			                // actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="authorizationItem(\'' + row.id + '\')"><i class="fa fa-upload"></i>授权</a> ');
			                
			                return actions.join('');
			          }
			     }]
		    };
		    $.table.init(options);
		});
		
	</script>
</body>
</html>